let str = `AB (bS-D2)+ "ABC" = D2:E2 ABCD A+B2 'good' `
let arr1 = []
let sep = `@~~~###@`

let reg1 = /(?<=(?:[-:\+\*\/><\?=%\(]|AND|OR|LIKE|<=|>=|\b)\s*)([A-Z])([1-9]?)(?=\s*(?:[-:\+\*\/><\?=%\)]|AND|OR|LIKE|<=|>=|\s+|\b))/g;

let res = str.replace(/(\'.+\'|\".+\")/g, function (match, p1, offset, string) {
    arr1.push(p1)
    return sep
})
let arr2 = res.split(sep)
console.log(res);
console.log(arr2);
let arr3 = arr2.map(item => {
    if (item) {
        return item.replace(reg1, function (match, p1, p2) {
            console.log(item, 'reg1',match,  p1, p2 )
            return `${p1}${p2 && p2 - 1}`
        })
    }
})
function getResult() {
    let i = 0
    return arr3.join(sep).replace(new RegExp(sep, 'g'),function () {
        return arr1[i++]
    })
}

console.log(getResult());
